using System;
using System.Collections.Generic;

namespace CMS.Core.Domain
{
    /// <summary>
    /// PhanQuyenNhom object for NHibernate mapped table PhanQuyenNhom.
    /// </summary>
    [Serializable]
    public class PhanQuyenNhom : DomainObject<PhanQuyenNhom.DomainObjectID>
    {

        [Serializable]
        public class DomainObjectID
        {
            public DomainObjectID() {}

            private System.Int32 _MaChucNang;
            private System.Int32 _MaNhom;

            public DomainObjectID(System.Int32 maChucNang, System.Int32 maNhom)
            {
                _MaChucNang = maChucNang;
                _MaNhom = maNhom;
            }

         public System.Int32 MaChucNang {
             get { return _MaChucNang; }
             protected set { _MaChucNang = value;}
         }

         public System.Int32 MaNhom {
             get { return _MaNhom; }
             protected set { _MaNhom = value;}
         }


            public override bool Equals(object obj)
            {
                if (obj == this) return true;
                if (obj == null) return false;

                DomainObjectID that = obj as DomainObjectID;
                if (that == null)
                {
                    return false;
                }
                else
                {
                    if (this.MaChucNang != that.MaChucNang) return false;
                    if (this.MaNhom != that.MaNhom) return false;

                    return true;
                }

            }

            public override int GetHashCode()
            {
                return MaChucNang.GetHashCode() ^ MaNhom.GetHashCode();
            }

        }

        private ChucNang _ChucNang;
        private NhomNguoiSuDung _NhomNguoiSuDung;        

        public PhanQuyenNhom()
        {
        }

        public PhanQuyenNhom(DomainObjectID id)
        {
            base.ID = id;
        }

         public virtual System.Int32 MaChucNang {
             get { return base.id.MaChucNang; }
         }

         public virtual System.Int32 MaNhom {
             get { return base.id.MaNhom; }
         }

         public virtual ChucNang ChucNang
         {
             get { return _ChucNang; }
             set { _ChucNang = value; }
         }

         public virtual NhomNguoiSuDung NhomNguoiSuDung
         {
             get { return _NhomNguoiSuDung; }
             set { _NhomNguoiSuDung = value; }
         }


        public override int GetHashCode()
        {
            return ID.GetHashCode();
        }

     }
}
